home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Precision Software Appli…tions Silver Collection 4
/
Precision Software Applications Silver Collection Volume 4 (1993).iso
/
stats
/
chadyn.exe
/
YCOMCM.C
< prev
next >
Wrap
Text File
|
1988-11-29
|
9KB
|
337 lines
/********************************* YCOMCM.C **********************************/
/********************* (C) 1986,7,8 by JAMES A. YORKE ************************/
#include "yinclud.h"
#ifdef X11
int caseColor(CodeName)
char *CodeName; /* unused now */
{
printf("Color is not implemented on X windows yet\n");
return;
}
#endif
#ifdef MS
static long colorNum = 0L; /* for background color */
#ifndef unix
#include <dos.h> /* for int86 */
#endif
int set_mode(void); /* prototype */
struct videoconfig vc; /* configuration data */
int caseColor(CodeName) /* CM commands */
char *CodeName;
{
int test;
#ifdef IGNORE
/* arguments to _setvideomode() */
#define _DEFAULTMODE -1 /* restore screen to original mode */
#define _TEXTBW40 0 /* 40 x 25 text, 16 grey */
#define _TEXTC40 1 /* 40 x 25 text, 16/8 color */
#define _TEXTBW80 2 /* 80 x 25 text, 16 grey */
#define _TEXTC80 3 /* 80 x 25 text, 16/8 color */
#define _MRES4COLOR 4 /* 320 x 200, 4 color */
#define _MRESNOCOLOR 5 /* 320 x 200, 4 grey */
#define _HRESBW 6 /* 640 x 200, BW */
#define _TEXTMONO 7 /* 80 x 25 text, BW */
#define _MRES16COLOR 13 /* 320 x 200, 16 color */
#define _HRES16COLOR 14 /* 640 x 200, 16 color */
#define _ERESNOCOLOR 15 /* 640 x 350, BW */
#define _ERESCOLOR 16 /* 640 x 350, 4 or 16 color */
#define _VRES2COLOR 17 /* 640 x 480, BW */
#define _VRES16COLOR 18 /* 640 x 480, 16 color */
#define _MRES256COLOR 19 /* 320 x 200, 256 color */
/* universal color values: */
#define _BLACK 0x000000L
#define _BLUE 0x2a0000L
#define _GREEN 0x002a00L
#define _CYAN 0x2a2a00L
#define _RED 0x00002aL
#define _MAGENTA 0x2a002aL
#define _BROWN 0x00152aL
#define _WHITE 0x2a2a2aL
#define _GRAY 0x151515L
#define _LIGHTBLUE 0x3F1515L
#define _LIGHTGREEN 0x153f15L
#define _LIGHTCYAN 0x3f3f15L
#define _LIGHTRED 0x15153fL
#define _LIGHTMAGENTA 0x3f153fL
#define _LIGHTYELLOW 0x153f3fL
#define _BRIGHTWHITE 0x3f3f3fL
EXTERN int corerows INITIAL(COREROWS);
EXTERN int corecols INITIAL(CORECOLS);
EXTERN int scrnrows INITIAL(SCRNROWS);
EXTERN int scrncols INITIAL(SCRNCOLS);
#define CORECOLS 960 /* Width of the internal memory's picture = */
/* The number of bits wide = */
/* width in bits of the printer output */
#define SCRNCOLS 640 /* Width of the crt screen. The program
assumes this is no bigger than CORECOLS */
#define COREROWS 68 /* About the max num of printer lines */
/* that are permited in 64 K */
#define SCRNROWS 200 /* height(bits) of crt screen */
#endif /* IGNORE */
#endif /* MS */
#ifndef MAINFRAME
#ifdef MS
TEST("psm")/* printer sub menu */
{
PSMenu();
return(1);
}
TEST("cim")/* color interrupt menu */
{
CIMenu();
return(1);
}
TEST("setmode")/* this resets the original wakeup mode of the program*/
{
SetVidMode();
ScreenConstants();
return(1);
}
TEST("ega")/* experimental for EGA boards */
{
_setvideomode(15);
scrnrows = 350;
scrncols = 640;
_getvideoconfig(&vc); /* put videoconfig data in vc */
ScreenConstants();
return(1);
}
TEST("black")/* sets backgound color */
{
_setbkcolor(0L);/* This sets the background color; the
command to black; "setbkcolor" sets
the background color */
return(1);
}
TEST("80")/* sets printer */
{
printMode = EPSONBW;
return(1);
}
TEST("spacing") { /* sets printer */
printerSpacing = (int) Entervalue((double) printerSpacing, CHECKSET);
return(1);
}
TEST("2500") { /* sets printer */
printMode = EPSONCOLOR;
return(1);
}
TEST("width") { /* sets printer */
test = corecols;
test = (int) Entervalue((double) test, CHECKSET);
if(test >= 48 && test < CORECOLS) {
corecols = test;
ScreenConstants();
}
else
PRINT
"Not acceptable; must be between 48 and %d \n", COREROWS);
return(1);
}
TEST("height") { /* sets printer */
PRINT
"height must be a multiple of 8 or it will be rounded down\n");
test = corerows * 8;
test = (int) Entervalue((double) test, CHECKSET);
if(test >= 48 && test < 8 * COREROWS) {
corerows = test / 8;
ScreenConstants();
}
else
PRINT
"Not acceptable; must be between 48 and %d \n", 8 * COREROWS);
return(1);
}
TEST("setbkcolor") { /* sets backgound color */
colorNum = (long) Entervalue((double) colorNum, CHECKSET);
if(level >= PROCESS) {
turnoff(BIGCROSS);
turnoff(SMALLCROSS);
color = colorNum;
scr_rowcol(1, 5);
if(printer >= 2)
PRINT "new BACKGROUND color = %ld \n"
,colorNum);
}
_setbkcolor(colorNum);
/* This sets the background color; the command
to black; "setbkcolor" sets the background
color */
if(level >= PROCESS) {
SetCross(SMALLCROSS);
turnoff(SMALLCROSS);
SetCross(SMALLCROSS);
}
return(1);
}
TEST("egacolor")/* experimental for EGA boards */
{
/* first try higher res modes */
_setvideomode(16);
scrnrows = 350;
scrncols = 640;
_getvideoconfig(&vc); /* put videoconfig data in vc */
_setcolor((color=12));/* 12 = light red
_setbkcolor(1L);/* This sets the background color; the command
"BLACK" sets the background back to black; "setbkcolor" sets
the background color; 1 = blue */
ScreenConstants();
return(1);
}
TEST("color")
{
if (colorGraphics() == 0)/* in YSCREEN.C */
return (1);/* could not change mode */
_getvideoconfig(&vc); /* put videoconfig data in vc */
_setcolor((color=2));/*
_setbkcolor(1L);/* This sets the background color; the command
"BLACK" sets the background back to black; "setbkcolor" sets
the background color; 1 = blue */
ScreenConstants();
return(1);
}
TEST("cga")/* experimental for EGA boards */
{
scrnrows = 200;
scrncols = 640;
_setvideomode(6);
_getvideoconfig(&vc); /* put videoconfig data in vc */
ScreenConstants();
return(1);
}
TEST("cgacolor")/* experimental for EGA boards */
{
_setvideomode(4);/* 320 x 200, 4 color */
scrnrows = 200;
scrncols = 320;
_getvideoconfig(&vc); /* put videoconfig data in vc */
ScreenConstants();
return(1);
}
TEST("prnoff")
{
prnFlag = OFF;
return(1);
}
TEST("f9")
{
f9();
return(1);
}
TEST("prnon")
{
prnFlag = ON;
return(1);
}
return(0);
#endif
#endif
}
ColorMenu() {
if(level == SETPARAM)
scr_clr(); /* in desmets pcio.a */
scr_rowcol(0, 2);
#ifdef X11
PRINT "COLOR IS NOT AVAILABLE WITH THIS VERSION \n");
#endif
#ifdef MS
PRINT
" COLOR SCREEN MENU \n\n");
PRINT
"This program supports several graphics boards:\n");
PRINT
" CGA 640X200 in black/white or 320X200 with 4 colors(incl B/W)\n");
PRINT
" HERCULES 720X348 in black/white\n");
PRINT
" EGA 640X350 in up to 16 colors\n");
PRINT
" VGA 640X480 in 16 colors or 320X200 in 256 colors\n\n");
/* PRINT
" BLACK: Sets background color to black \n");
PRINT
" SETBKCOLOR: SET BacKground COLOR -does not seem to work\n");
*/
PRINT
"more colors? \n");
PRINT
" COLOR: 320X200 in more colors: \n");
PRINT " 2 colors in CGA and 256 in VGA\n");
PRINT " interrupt 'Z' cycles through 4 palettes for CGA\n");
PRINT
" SETMODE: SETs the original screen MODE - undoes COLOR \n");
PRINT
" Q: set color table -- VGA color monitors only\n\n");
PRINT
"SUBMENUS\n");
PRINT
" PSM: Printer Sub Menu \n");
PRINT
" CIM: Color Interrupt submenu\n");
#endif
}
PSMenu()/* Printer Sub Menu */
{
PRINT
"\n\n PRINTER SUB MENU \n\n");
PRINT
" 80: says you have an Epson MX 80 or compatible printer (= default)\n");
PRINT
" 2500: says you have an Epson MX 2500 COLOR printer\n");
PRINT
"SPACING: Sets printer spacing between graphics lines (default 24) now= %d\n",
printerSpacing);
PRINT
" WIDTH: Number of dots wide the internal core picture should be, now %d\n",
corecols);
PRINT
" HEIGHT: Number of dots high the internal core picture should be, now %d\n",
corerows*8);
/**********************
PRINT
" PRNON: PRiNter ON-- text to printer instead of plotting screen\n");
PRINT
" PRNOFF: return to normal mode, sending text to plotting screen\n");
PRINT " \n");
***********************/
}
CIMenu()/* Color Interrupt Menu */
{
PRINT
"\n\n COLOR INTERRUPT MENU \n\n");
PRINT
" interrupt Q: change color table -- VGA only \n");
PRINT
" interrupt F5: interrupt i and then decrease number of color by 1 \n");
PRINT
" interrupt F6: interrupt i and then increase number of color by 1 \n");
PRINT
" interrupt F7: decrease number of color by 1 \n");
PRINT
" interrupt F8: increase number of color by 1\n");
PRINT
" interrupt F9: then enter integer value of color, then hit <Enter>\n");
/* PRINT
"Current number of color planes = %d\n",colorPlanes);
*/
}